﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FingerMove : MonoBehaviour {

	public Vector3 beginPos = Vector3.zero;
	public Vector3 endPos = Vector3.zero;


	private Vector3 distance = Vector3.zero;

	public RectTransform rectTransform = null;

	LTDescr ld = null;

	public void Begin( Vector3 begin, Vector3 end)
	{
		beginPos = begin;
		endPos = end;

		distance = end - begin;

		rectTransform.anchoredPosition = begin;
	}

	void OnEnable()
	{
		rectTransform.anchoredPosition = beginPos;
//		tempTime = 0;
		LeanTween.move (rectTransform, endPos, 1.5f).setLoopClamp ();
		Debug.Log ("move open");
	}

/*	float tempTime = 0;
	void FixedUpdate()
	{
		tempTime += Time.fixedDeltaTime;
		rectTransform.Translate (distance * Time.fixedDeltaTime);
		if (tempTime >= 0.9f) {
		
			rectTransform.anchoredPosition = beginPos;
			tempTime = 0;
		}

	}*/

	void OnDisable()
	{
		LeanTween.cancel (gameObject, false);
		Debug.Log ("move close");
	}

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
